package com.atgui.yygh.controller;

import com.atgui.yygh.model.hosp.Schedule;
import com.atgui.yygh.service.ScheduleService;
import com.atguigu.yygh.result.Result;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

/**
 * zz: wzh
 * time 2022 09 05 15 20
 **/
@RestController
@RequestMapping("/admin/hosp/schedule")
//@CrossOrigin
public class ScheduleController {
    @Autowired
    private ScheduleService scheduleService;

    //根据医院编号和科室编号查询排班数据
    @ApiOperation("查询排班数据")
    @GetMapping("getScheduleRule/{page}/{limit}/{hoscode}/{depcode}")
    public Result getScheduleRule(@PathVariable Long page,
                                  @PathVariable Long limit,
                                  @PathVariable String hoscode,
                                  @PathVariable String depcode){
        Map<String,Object> map=scheduleService.getScheduleRule(page,limit,hoscode,depcode);
        return Result.ok(map);
    }
    //根据医院编号和科室编号查询排班数据和工作日期,查询排版规则
    @ApiOperation("查询排版详细信息")
    @GetMapping("getScheduleRule/{hoscode}/{depcode}/{workDate}")
    public Result getScheduleDetail(@PathVariable String hoscode,
                                  @PathVariable String depcode,
                                  @PathVariable String workDate){
        List<Schedule> list =scheduleService.getScheduleDetail(hoscode,depcode,workDate);
        return Result.ok(list);
    }
}
